package com.jd.cmdb.tsc.dao;

import com.jd.cmdb.tsc.entity.Task;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * Created by tianzhengguo on 2016/1/11.
 */
@Repository
public class TaskDaoImpl extends BaseDao implements TaskDao {
    public List<Task> selAllTasks() throws Exception {
        List<Task> tasks = getSqlSession().selectList("task.selectAll");
        return tasks;
    }

    @Override
    public List<Task> selAllTasks(short[] states) throws Exception {
        return getSqlSession().selectList("task.selectByStateIn",states);
    }

    @Override
    public List<Task> selTasksByState(short state) throws Exception {
        return null;
    }

    public int countAllTasks() throws Exception {
        return 0;
    }

    public Task selTask(String taskId) throws Exception {
//        Task task = getSqlSession().selectOne("",taskId);
//        return task;
        return null;
    }

    public int updateTask(String taskId) throws Exception {
        return 0;
    }

    public int updateTask(Task task) throws Exception {
        return getSqlSession().update("task.update",task);
    }

    @Override
    public int updateTaskByStates(Map<String,Object> task) throws Exception {
        return getSqlSession().update("task.updateByStates",task);
    }

    public int addTask(Task task) throws Exception {
        return 0;
    }

    public int deleteTask(String taskId) throws Exception {
        return 0;
    }
}
